package com.upu173.music.utils;

import android.content.Context;
import android.content.Intent;

import com.upu173.music.receiver.PlayerManagerReceiver;

public class MusicControler {

    public static void  startPlayReceiver(Context context,String path){
        Intent intent = new Intent(PlayerManagerReceiver.ACTION_MUSIC_PLAYER);
        intent.putExtra(PlayerManagerReceiver.MESSAGE_KEY,PlayerManagerReceiver.MESSAGE_PLAY);
        intent.putExtra(PlayerManagerReceiver.EXTRA_VALUE_PATH,path);
        context.sendBroadcast(intent);
    }

    public static void  pausePlayReceiver(Context context){
        Intent intent = new Intent(PlayerManagerReceiver.ACTION_MUSIC_PLAYER);
        intent.putExtra(PlayerManagerReceiver.MESSAGE_KEY,PlayerManagerReceiver.MESSAGE_PAUSE);
        context.sendBroadcast(intent);
    }

    public static void  seekToReceiver(Context context,int currentTime){
        Intent intent = new Intent(PlayerManagerReceiver.ACTION_MUSIC_PLAYER);
        intent.putExtra(PlayerManagerReceiver.MESSAGE_KEY,PlayerManagerReceiver.MESSAGE_SEEKTO);
        intent.putExtra(PlayerManagerReceiver.EXTRA_VALUE_SEEKTO,currentTime);
        context.sendBroadcast(intent);
    }

    public static void releasePlay(Context context) {
        Intent intent = new Intent(PlayerManagerReceiver.ACTION_MUSIC_PLAYER);
        intent.putExtra(PlayerManagerReceiver.MESSAGE_KEY,PlayerManagerReceiver.MESSAGE_RELEASE);
        context.sendBroadcast(intent);
    }
}
